package com.cskaoyan.service;

import com.cskaoyan.bean.MarketBrand;
import com.cskaoyan.bean.MarketBrandExample;
import com.cskaoyan.mapper.MarketBrandMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MarketBrandServiceImpl implements MarketBrandService {

    @Autowired
    MarketBrandMapper marketBrandMapper;

    @Override
    public List<MarketBrand> selectBrand(Integer page, Integer limit) {
        PageHelper.startPage(page,limit);

        MarketBrandExample example = new MarketBrandExample();
        example.setOrderByClause("id asc");
        List<MarketBrand> marketBrands = marketBrandMapper.selectByExample(example);

        return marketBrands;
    }

    @Override
    public MarketBrand selectBrandById(Integer id) {
        MarketBrand marketBrand = marketBrandMapper.selectByPrimaryKey(id);
        return marketBrand;
    }
}
